"use strict";
define(["jquery", "bootstrap", "backend", "table", "form"], function (e, t, a, i, r) {
    var n = {
        index: function () {
            i.api.init({
                extend: {
                    index_url: "wanlshop/auth/index" + location.search,
                    edit_url: "",
                    del_url: "wanlshop/auth/del",
                    multi_url: "wanlshop/auth/multi",
                    table: "wanlshop_auth"
                }
            });
            var t = e("#table");
            t.bootstrapTable({
                url: e.fn.bootstrapTable.defaults.extend.index_url,
                pk: "id",
                sortName: "id",
                columns: [[{
                    checkbox: !0
                }, {
                    field: "id",
                    title: __("Id")
                }, {
                    field: "state",
                    title: __("入驻类型") ,searchList: {
                 
                        1: __("商家"),
                        2: __("塘主"),

                    },
                    formatter: i.api.formatter.status
                 },  {
                    field: "shopname",
                    title: __("企业名称")
                 },
                 {
                    field: "name",
                    title: __("法人姓名")
                 }, 
                  {
                    field: "mobile",
                    title: __("法人手机号")
                }, {
                    field: "number",
                    title: __("法人身份证号")
                },
                {
                    field: "province",
                    title: __("省")
                }, 
                {
                    field: "city",
                    title: __("市")
                }, 
                 {
                    field: "district",
                    title: __("区")
                }, 
                {
                    field: "address",
                    title: __("详细地址")
                },  {
                    field: "verify",
                    title: __("状态"),
                    searchList: {
                        0: __("审核中"),
                        1: __("审核通过"),
                        2: __("审核拒绝"),
                    
                    },
                    formatter: i.api.formatter.status
                }, {
                    field: "operate",
                    title: __("Operate"),
                    table: t,
                    events: i.api.events.operate,
                    buttons: [{
                        name: "agree",
                        title: __("通过店铺审核"),
                        classname: "btn btn-xs btn-success btn-magic btn-ajax",
                        icon: "fa fa-check",
                        text: "通过",
                        confirm: "确认点击通过，通过店铺审核？",
                        url: "wanlshop/auth/agree",
                        visible: function (e) {
                            if (0 == e.verify) return !0
                        },
                        success: function (e, a) {
                            return t.bootstrapTable("refresh"), !1
                        },
                        error: function (e, t) {
                            return console.log(e, t), Layer.alert(t.msg),
                                !1
                        }
                    }, {
                        name: "refuse",
                        title: __("店铺审核不通过"),
                        classname: "btn btn-xs btn-danger btn-dialog",
                        icon: "fa fa-times",
                        text: "不通过",
                        url: "wanlshop/auth/refuse",
                        visible: function (e) {
                            if (0 == e.verify) return !0
                        },
                        extend: 'data-area=["500px","270px"]'
                    }, {
                        name: "detail",
                        title: __("详情"),
                        classname: "btn btn-xs btn-info btn-dialog",
                        icon: "fa fa-eye",
                        url: "wanlshop/auth/detail"
                    }],
                    formatter: i.api.formatter.operate
                }]]
            }), i.api.bindevent(t)
        },
        recyclebin: function () {
            i.api.init({
                extend: {
                    dragsort_url: ""
                }
            });
            var t = e("#table");
            t.bootstrapTable({
                url: "wanlshop/auth/recyclebin" + location.search,
                pk: "id",
                sortName: "id",
                columns: [[{
                    checkbox: !0
                }, {
                    field: "id",
                    title: __("Id")
                }, {
                    field: "name",
                    title: __("Name"),
                    align: "left"
                }, {
                    field: "deletetime",
                    title: __("Deletetime"),
                    operate: "RANGE",
                    addclass: "datetimerange",
                    formatter: i.api.formatter.datetime
                }, {
                    field: "operate",
                    width: "130px",
                    title: __("Operate"),
                    table: t,
                    events: i.api.events.operate,
                    buttons: [{
                        name: "Restore",
                        text: __("Restore"),
                        classname: "btn btn-xs btn-info btn-ajax btn-restoreit",
                        icon: "fa fa-rotate-left",
                        url: "wanlshop/auth/restore",
                        refresh: !0
                    }, {
                        name: "Destroy",
                        text: __("Destroy"),
                        classname: "btn btn-xs btn-danger btn-ajax btn-destroyit",
                        icon: "fa fa-times",
                        url: "wanlshop/auth/destroy",
                        refresh: !0
                    }],
                    formatter: i.api.formatter.operate
                }]]
            }), i.api.bindevent(t)
        },
        refuse: function () {
            n.api.bindevent()
        },
        edit: function () {
            n.api.bindevent()
        },
        api: {
            bindevent: function () {
                r.api.bindevent(e("form[role=form]"))
            }
        }
    };
    return n
});